<?php

/**
 * ParticipantVersion form base class.
 *
 * @method ParticipantVersion getObject() Returns the current form's model object
 *
 * @package    BuLaBuSys2013
 * @subpackage form
 * @author     Maximilian Lenkeit
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseParticipantVersionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'first_name'       => new sfWidgetFormInputText(),
      'last_name'        => new sfWidgetFormInputText(),
      'gender'           => new sfWidgetFormChoice(array('choices' => array('m' => 'm', 'f' => 'f'))),
      'date_of_birth'    => new sfWidgetFormDate(),
      'vegetarian'       => new sfWidgetFormInputCheckbox(),
      'chapter'          => new sfWidgetFormInputText(),
      'age_group'        => new sfWidgetFormChoice(array('choices' => array('b' => 'b', 'w' => 'w', 'p' => 'p', 'r' => 'r', 'm' => 'm'))),
      'accomodation'     => new sfWidgetFormChoice(array('choices' => array('t' => 't', 'h' => 'h'))),
      'booking_id'       => new sfWidgetFormInputText(),
      'price_scaling_id' => new sfWidgetFormInputText(),
      'created_at'       => new sfWidgetFormInputText(),
      'updated_at'       => new sfWidgetFormInputText(),
      'deleted_at'       => new sfWidgetFormInputText(),
      'created_by'       => new sfWidgetFormInputText(),
      'updated_by'       => new sfWidgetFormInputText(),
      'deleted_by'       => new sfWidgetFormInputText(),
      'version'          => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'first_name'       => new sfValidatorString(array('max_length' => 255)),
      'last_name'        => new sfValidatorString(array('max_length' => 255)),
      'gender'           => new sfValidatorChoice(array('choices' => array(0 => 'm', 1 => 'f'), 'required' => false)),
      'date_of_birth'    => new sfValidatorDate(array('required' => false)),
      'vegetarian'       => new sfValidatorBoolean(array('required' => false)),
      'chapter'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'age_group'        => new sfValidatorChoice(array('choices' => array(0 => 'b', 1 => 'w', 2 => 'p', 3 => 'r', 4 => 'm'), 'required' => false)),
      'accomodation'     => new sfValidatorChoice(array('choices' => array(0 => 't', 1 => 'h'), 'required' => false)),
      'booking_id'       => new sfValidatorInteger(),
      'price_scaling_id' => new sfValidatorInteger(),
      'created_at'       => new sfValidatorPass(array('required' => false)),
      'updated_at'       => new sfValidatorPass(array('required' => false)),
      'deleted_at'       => new sfValidatorPass(array('required' => false)),
      'created_by'       => new sfValidatorInteger(array('required' => false)),
      'updated_by'       => new sfValidatorInteger(array('required' => false)),
      'deleted_by'       => new sfValidatorInteger(array('required' => false)),
      'version'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('version')), 'empty_value' => $this->getObject()->get('version'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('participant_version[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ParticipantVersion';
  }

}
